package com.example.sangong.controller;

import com.example.sangong.http.Result;
import com.example.sangong.myannotation.SysLog;
import com.example.sangong.req.Req;
import com.example.sangong.req.log.LogStaticsQueryReq;
import com.example.sangong.service.SgLogService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;

@RestController
@RequestMapping("/log")
@Api(tags = "日志")
public class SysLogController {
    @Resource
    private SgLogService sgLogService;

    @PostMapping("/getLogStatics")
    @SysLog("查询接口调用统计信息")
    public Result getLogStatics(@RequestBody Req<LogStaticsQueryReq> req) {
        return Result.success(sgLogService.getLogStatics(req.getReq()));

    }
    @GetMapping("/getSystemName")
    public Result getSystemName() throws UnknownHostException {
        return Result.success(sgLogService.getSystemName());

    }
}
